//
//  FirstNextViewController.m
//  MvcTest
//
//  Created by SDMac on 15/5/12.
//  Copyright (c) 2015年 SDMac. All rights reserved.
//

#import "FirstNextViewController.h"

@interface FirstNextViewController ()

@end

@implementation FirstNextViewController

#pragma mark ---- life cycle

- (void)loadView
{
    _firstView = [[FirstView alloc]initWithFrame:CGRectMake(0, 0, ScreenBunds.size.width, ScreenBunds.size.width)];
    
    [_firstView.btn addTarget:self action:@selector(getAction:) forControlEvents:UIControlEventTouchUpInside];
    
    self.view = _firstView;
    
    self.view.backgroundColor = [UIColor whiteColor];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    self.title = @"下一个";
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark ---- UITableViewDelegate

#pragma mark ---- CustomDelegate

- (void)returnText:(ReturnTextBlock)block
{
    self.returnTextBlock = block;
}

#pragma mark ---- event response

-(void)getAction:(UIButton *)sender
{
    ReturnTextBlock block = self.returnTextBlock;
    
    // block现在是本地不可变的,如果block不等于nil
    if (block)
    {
        self.returnTextBlock(@"秦仲海",@"34",@"男");
    }
    
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark ---- private methods

#pragma mark ---- getters and setters

@end
